package control;

import database.Database;
import java.sql.SQLException;
import model.Address;

/**
 * Denne klasses opgave er at kunne tilføje en adresse til systemet.
 * @author Sonny Sandberg
 */
public abstract class AddressControl 
{
    /**
     * Tilføj adresse
     * @param Address
     * @return int
     * @throws ClassNotFoundException
     * @throws SQLException 
     */
    public static int addAddress(Address address) throws ClassNotFoundException, SQLException
    {
        Database db = new Database();
        
        int added = db.manipulateDB("INSERT INTO bs_address (street, zip_code) "
                + "VALUES ('"+address.getStreet()+"', '"+address.getZipCode().getZipCode()+"')");
        
        db.closeDB();
        
        return added;
    }
}